package service;

import dao.UserDao;

import java.util.Scanner;

/**
 * @Description 作为用户的UserService层
 * @Author hhy
 */
public class UserService {
    UserDao userDao = new UserDao();
    Scanner sc =  new Scanner(System.in);

    /**
     *
     * @return 返回是否登录成功
     */
    public boolean userLogin(){
        System.out.println("请输入你的用户名");
        String username = sc.next();
        System.out.println("请输入你的密码");
        String password = sc.next();
        return userDao.userLogin(username,password);
    }

    /**
     *
     * @return 返回是否注册成功
     */
    public boolean userRegister(){
        System.out.println("请输入你的用户名");
        String username = sc.next();
        System.out.println("请输入你的密码");
        String password = sc.next();
        return userDao.userRegister(username,password);
    }

    /**
     * 测试功能，用于查看用户是否被注册
     */
    public void selectAlluser(){
        userDao.selectAlluser();
    }
}
